package com.sop.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.sop.dao.PeopleRoleDao;
import com.sop.model.PeopleRole;
import com.sop.model.RoleInfo;
import com.sop.model.vo.PeopleRoleVo;

import common.base.dao.IBaseDaoImpl;

@Repository("peopleRoleDao")
public class PeopleRoleDaoImpl extends IBaseDaoImpl<PeopleRole,PeopleRoleVo> implements PeopleRoleDao{
    	
	@SuppressWarnings("unchecked")
	@Override
       public List<RoleInfo> findRoleByPeoId(Integer peoId){
		  return super.sessionFactory.getCurrentSession().
				   createQuery("from  RoleInfo where id in (SELECT roleId FROM PeopleRole where peopleId =:peoId)")
				   .setInteger("peoId", peoId).list();
       }


	@Override
	public Criteria getSearchCriteria(Session session, PeopleRoleVo searchVo) {
		// TODO Auto-generated method stub
		return null;
	}
       
}
